﻿<?php
class qqzan{
	function set($qq,$sid){
		$this->qq=$qq;
		$this->sid=$sid;
	}
	function getnew(){
		if($this->sid){
			
            if(!isset($stop)){
            $url="http://m.qzone.com/get_feeds?g_tk=".time()."&res_type=0&refresh_type=2&format=json&sid=".$this->sid;
			$json=file_get_contents($url);
			$arr=json_decode($json,true);
			if(@array_key_exists('code',$arr) && $arr['code']==0){
				$shuos=$arr['data']['vFeeds'];
				foreach($shuos as $shuo){
					$like=$shuo['like']['isliked'];
					if($like==0){
						$type=$shuo['comm']['appid'];
						$curkey=urlencode($shuo['comm']['curlikekey']);
						$uinkey=urlencode($shuo['comm']['orglikekey']);
						$uin=$shuo['userinfo']['user']['uin'];
						$this->sendlike($uin,$type,$uinkey,$curkey);
						sleep(1);
					}
                    //*

				}
			}
            }
		}
	}


	function sendlike($uin,$type,$uinkey,$curkey){
		$post="opr_type=like&action=0&res_uin=$uin&res_type=$type&uin_key=$uinkey&cur_key=$curkey&format=json&sid=".$this->sid;
		$url="http://m.qzone.com/praise/like?g_tk=1223463111";
		$json=$this->getcurl($url,$post);
		$arr=json_decode($json,true);
		
	}

	function getcurl($url,$post){
		$ch=curl_init($url);
		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		if($post){
			curl_setopt($ch, CURLOPT_POST, 1);
			curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
		}
		$content = curl_exec($ch);
		curl_close($ch); 
		return $content;
	}

    
}
